1. Field
Apparatuses and methods consistent with exemplary embodiments relate to video encoding and decoding, and more particularly, to a method and apparatus for encoding and decoding a video to reduce memory access for reading out data of a reference frame during motion compensation.
2. Description of the Related Art
In order to encode a video, one picture is split into predetermined data units such as macroblocks. Each of the macroblocks is prediction-encoded by using inter prediction or intra prediction.
Inter prediction which is a method of compressing an image by removing temporal redundancy between pictures uses motion estimation and motion compensation. The motion estimation predicts blocks of a current picture by using at least one reference picture. The motion estimation and the motion compensation are processes of searching for a reference block which is most similar to a current block in a predetermined search range by using a predetermined evaluation function and reading out data of the reference block which is most similar to the current block. In order to more accurately perform the motion estimation and the motion compensation, subpixels between integer pixels are generated by performing interpolation in the predetermined search range of the reference picture, and the motion estimation and the motion compensation are performed based on the reference picture having subpixel precision. In order to perform the motion estimation and the motion compensation at the subpixel precision, a process of interpolating data of the reference picture is needed.
In the related art, interpolation is performed by using a finite impulse response (FIR) filter having a predetermined tap number. An N-tap FIR filter interpolates a subpixel by using N neighboring integer pixels. In order to interpolate one subpixel in a process of performing interpolation by using an N-tap FIR filter, N reference pixels need to be read out from a memory. If both a horizontal component and a vertical component of a motion vector have a subpixel precision, since a two-dimensional (2D) interpolation process needs to be performed in horizontal and vertical directions, the number of times memory access is performed increases. The number of times memory access is performed for bi-directional motion is two times greater than the number of times memory access is performed for uni-directional motion estimation because two reference pictures are used.